﻿using System;
using UnityEngine;

// Token: 0x020000A5 RID: 165
public class MortalRigidBrake : MonoBehaviour
{
	// Token: 0x0600052E RID: 1326 RVA: 0x0001E8A8 File Offset: 0x0001CAA8
	private void Start()
	{
		if (this.rememberChilds)
		{
			this.childs = base.gameObject.GetComponentsInChildren<RigidBrake>(true);
		}
	}

	// Token: 0x0600052F RID: 1327 RVA: 0x0001E8C8 File Offset: 0x0001CAC8
	private void Update()
	{
		this.timer += Time.deltaTime;
		if (this.timer > this.spanOfLife)
		{
			if (this.childs != null)
			{
				for (int i = 0; i < this.childs.Length; i++)
				{
					if (this.childs[i] != base.gameObject)
					{
						this.childs[i].transform.SetParent(base.transform);
					}
				}
			}
			UnityEngine.Object.Destroy(base.gameObject);
		}
	}

	// Token: 0x04000424 RID: 1060
	public float spanOfLife = 1f;

	// Token: 0x04000425 RID: 1061
	public bool rememberChilds = true;

	// Token: 0x04000426 RID: 1062
	private float timer;

	// Token: 0x04000427 RID: 1063
	private RigidBrake[] childs;
}
